<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>

<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<title>鼠标点击拾取坐标</title>
</head>
<body>
<div id="l-map"></div>
<div id="r-result"></div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("l-map");
map.centerAndZoom("宁波",15);                   // 初始化地图,设置城市和地图级别。
map.enableScrollWheelZoom();                            //启用滚轮放大缩小

map.addEventListener("click", function(e){
  document.getElementById("r-result").innerHTML = e.point.lng + ", " + e.point.lat;
});
var myIcon = new BMap.Icon("image/mapsA.gif", new BMap.Size(20,20));
myIcon.setAnchor(new BMap.Size(7,16));
var marker1 = new BMap.Marker(new BMap.Point(121.584252, 29.87815),{icon:myIcon});  // 创建标注
map.addOverlay(marker1);

//创建信息窗口
var infoWindow1 = new BMap.InfoWindow("地点一");
marker1.openInfoWindow(infoWindow1);
myIcon.setInfoWindowAnchor(new BMap.Size(8,2));
marker1.addEventListener("click", function(){this.openInfoWindow(infoWindow1);});


//标注二
var myIcon2 = new BMap.Icon("image/mapsA.gif", new BMap.Size(20,20));
myIcon2.setAnchor(new BMap.Size(7,16));
var marker2 = new BMap.Marker(new BMap.Point(121.603584, 29.87671),{icon:myIcon2});  // 创建标注
map.addOverlay(marker2);

//创建信息窗口
var infoWindow2 = new BMap.InfoWindow("地点二");
myIcon2.setInfoWindowAnchor(new BMap.Size(8,2));
marker2.addEventListener("click", function(){this.openInfoWindow(infoWindow2);});

</script>